<div class="layui-form" lay-filter="layuiadmin-form-tags" id="layuiadmin-form">
    <div class="layui-form-item">
        <label class="layui-form-label">标题</label>
        <div class="layui-input-inline">
            <script type="text/html" template>
                <input type="text" name="title" value="{{ d.params.title || '' }}" lay-verify="required"
                       placeholder="请输入..." autocomplete="off" class="layui-input">
            </script>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">上级分类</label>
        <div class="layui-input-inline append-category">

        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">跳转地址</label>
        <div class="layui-input-inline">
            <script type="text/html" template>
                <input type="text" name="url" value="{{ d.params.url || '' }}"
                       placeholder="请输入..." autocomplete="off" class="layui-input">
            </script>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">排序</label>
        <div class="layui-input-inline">
            <script type="text/html" template>
                <input type="text" name="sort" value="{{ d.params.sort || '0' }}" lay-verify="required"
                       placeholder="请输入..." autocomplete="off" class="layui-input">
            </script>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-input-inline">
            <input type="button" lay-submit lay-filter="layuiadmin-submit" value="确认" class="layui-btn">
        </div>
    </div>
</div>
<style>
    #image{
        width: 150px;
        height: 150px;
    }
</style>
<script>
    layui.use(['form', 'helper', 'laytpl', 'upload', 'element'], function () {
        var form = layui.form,
            $ = layui.$,
            setter = layui.setter,
            helper = layui.helper;
        form.render('select');
        let id = 0 , url = '/app/navigation-index/edit';
        if (window.params){
            id = window.params['id'];
            url += '?id=' + id;
            if (window.params['type'] == 'add-sub'){
                url += '&sub=1';
            }
        }
        helper.requestRenderSelect(url , 'pid' , '.append-category' , form)
    });
</script>